	var app = angular.module("xx",[]);
app.directive("cc",function($timeout){
	return{
		restrict:"AE",
		templateUrl:"svg/index.html",
		replate:true,
		link:function(scope,element,attr){
			
			$timeout(function(){
						//当页面加载状态改变的时候执行这个方法
document.onreadystatechange = function () {
    "interactive" === document.readyState && (function () {
        function a() {
            function c() {
            }

            if (!o[0]["part-1"].path.inAnim().length && q) {
                var d, e = 0, f = 0;
                for (b = 0; b < p.length; b += 1) {
                    f += 1;
                    for (var g in o[b])e += 1, d = o[b][g].state + 1, d + 1 > p[b].length ? (o[b][g].path.attr({d: p[b][0]}), o[b][g].state = 0, o[b][g].path.animate({d: p[b][0]}, r, f >= p.length ? a : c)) : (o[b][g].state = d, o[b][g].path.animate({d: p[b][d]}, r))
                }
            }
        }

        //定义变量
        var b, c, d, e = new Snap("#onmark"), f = $("#onmark"), g = e.select("#onmark-arrow"),
            h = e.select("#onmark-arrpath"), i = h.getTotalLength(), j = e.select("#onmark-arrline"),
            k = e.select("#globe-mask-g1"), l = e.select("#globe-mask-g2"), m = e.select("#onmark-globe"),
            n = m.getBBox(), o = [{}, {}, {}, {}],
            p = [["M34.53,24.899 c-3.219,1.377-6.172,3.439-8.13,6.577l0,0C28.327,28.184,31.968,25.917,34.53,24.899C34.681,24.868,34.377,24.929,34.53,24.899 L34.53,24.899L34.53,24.899z",
                "M34.53,24.899l-3.315,6.577H26.4 C27.922,28.595,32.338,25.553,34.53,24.899C34.681,24.868,34.377,24.929,34.53,24.899L34.53,24.899L34.53,24.899z",
                "M40.246,23.91v7.566h-7.021 c0.91-3.02,3.009-5.733,4.306-7.479c0.15-0.031,0.301-0.059,0.454-0.088H40.246L40.246,23.91z",
                "M44.905,23.998c0,0,3.203,3.856,4.306,7.479 h-7.021V23.91h2.262L44.905,23.998L44.905,23.998z",
                "M47.905,24.899 c2.953,1.143,6.234,3.439,8.13,6.577h-4.819C51.216,31.477,50.312,28.589,47.905,24.899L47.905,24.899L47.905,24.899L47.905,24.899 z",
                "M47.905,24.899 c2.953,1.143,6.234,3.439,8.13,6.577l0,0C56.035,31.477,53.687,27.136,47.905,24.899L47.905,24.899L47.905,24.899L47.905,24.899z"],
                ["M25.098,33.433L25.098,33.433 c-1.189,2.278-1.914,4.843-2.046,7.565l0,0C23.296,38.042,23.765,36.136,25.098,33.433L25.098,33.433z",
                    "M30.655,33.403 c-2.545,0-3.086,0.057-5.558,0.058c-1.189,2.278-1.914,4.843-2.046,7.565h6.316C29.449,38.061,29.727,36.051,30.655,33.403 L30.655,33.403z",
                    "M40.246,33.433 c-2.545,0-4.95,0-7.734,0c-0.919,2.516-1.28,4.843-1.412,7.565h9.146C40.171,37.933,40.312,36.511,40.246,33.433L40.246,33.433z",
                    "M49.949,33.433 c-2.545,0-4.95,0-7.734,0c-0.025,3.422-0.025,4.719-0.025,7.565h9.146C51.261,37.933,50.78,35.917,49.949,33.433L49.949,33.433z",
                    "M57.338,33.433 c-2.545,0-2.748-0.028-5.532-0.028c1.011,3.253,1.119,4.716,1.262,7.594h6.316C59.309,37.933,58.275,35.47,57.338,33.433 L57.338,33.433z",
                    "M57.338,33.433L57.338,33.433 c1.394,3.343,1.771,4.109,2.046,7.565l0,0C59.309,37.933,58.343,35.417,57.338,33.433L57.338,33.433z"],
                ["M25.098,50.36 c-1.474-2.74-1.833-5.178-2.046-7.565l0,0C23.184,45.518,23.908,48.082,25.098,50.36c2.472,0.001,3.013,0.058,5.558,0.058 L25.098,50.36z",
                    "M30.655,50.418 c-0.929-2.647-1.206-4.657-1.287-7.623h-6.316c0.132,2.723,0.856,5.287,2.046,7.565C27.569,50.361,28.11,50.418,30.655,50.418 L30.655,50.418z",
                    "M40.246,50.389c0-2.722,0-4.581,0-7.565H31.1 c0.103,2.813,0.493,4.906,1.383,7.565c2.472,0.001,3.313,0,6.251,0H40.246z",
                    "M49.953,50.389 c0.597-1.925,1.383-4.581,1.383-7.565h-9.146c0,2.833,0,4.708,0,7.565C44.661,50.39,47.016,50.389,49.953,50.389L49.953,50.389z",
                    "M57.338,50.389 c1.075-2.128,1.849-4.425,2.046-7.565h-6.316c-0.136,2.874-0.068,3.953-1.287,7.623C54.64,50.389,54.78,50.414,57.338,50.389 L57.338,50.389z",
                    "M57.338,50.389 c1.075-2.128,1.849-4.425,2.046-7.565l0,0C59.248,45.697,58.53,47.995,57.338,50.389L57.338,50.389L57.338,50.389z"],
                ["M34.53,58.922L34.53,58.922 L34.53,58.922c-2.766-0.969-6.422-3.63-8.13-6.577l0,0C27.796,54.698,30.733,57.448,34.53,58.922L34.53,58.922z",
                    "M34.53,58.922L34.53,58.922 L34.53,58.922c-2.766-0.969-6.422-3.63-8.13-6.577h4.809C31.702,53.808,32.843,56.511,34.53,58.922L34.53,58.922z",
                    "M40.246,59.911h-2.262 c-0.153-0.029-0.304-0.057-0.454-0.088c-1.297-1.745-3.396-4.459-4.306-7.479h7.021V59.911L40.246,59.911z",
                    "M44.905,59.823l-0.454,0.088 c-0.153-0.029-2.111,0.031-2.262,0c-0.019-3.525,0-4.604,0-7.566h7.021C48.382,55.269,46.228,58.021,44.905,59.823L44.905,59.823z",
                    "M47.905,58.922L47.905,58.922 L47.905,58.922c1.853-3.171,1.975-3.016,3.311-6.577l4.819-0.004C54.109,55.74,50.463,57.865,47.905,58.922L47.905,58.922z",
                    "M47.905,58.922L47.905,58.922 L47.905,58.922c4.433-2.119,6.1-3.682,8.13-6.581l0,0C54.109,55.74,50.463,57.865,47.905,58.922L47.905,58.922z"]],
            q = !1, r = 500;
        for (b = 0; b < p.length; b += 1) {
            for (c = 0; c < p[b].length; c += 1) {
                d = e.path(p[b][c]).attr({fill: "#009DDC"}).appendTo(m), o[b]["part-" + c] = {
                    path: d,
                    state: c
                };
            }
        }
        j.attr({
            stroke: "#009DDC",
            strokeWidth: 9,
            "stroke-linejoin": "round",
            "stroke-dasharray": "45 55"
        }),
            //     f.on({
            //     //当鼠标指针进入（穿过）元素时触发事件
            //     mouseenter: function () {
            //         q = !0, a(), j.attr({"stroke-dasharray": "0 55"}),
            //             k.attr({offset: .29}), l.attr({offset: .2901}),
            //             Snap.animate(0, i, function (a) {
            //                 if (a > 48)var a = 48;
            //                 var b = h.getPointAtLength(a);
            //                 g.transform("t" + parseInt(b.x - 63) + "," + parseInt(b.y - 42) + "r" + (b.alpha - 15));
            //                 var c = a - 1;
            //                 j.attr({"stroke-dasharray": (0 > c ? 0 : c) + " 55"}), a >= 48 ? (k.attr({offset: 1}), l.attr({offset: 1})) : (k.attr({offset: a / 48 * .55 + .29}), l.attr({offset: a / 48 * .55 + .2901}))
            //             }, 1000), m.stop().animate({transform: "scale(1.45, 1.45, " + n.cx + ", " + n.cy + ")"}, 600, mina.bounce)
            //     },
            //     //鼠标离开时触发事件
            //     mouseleave: function () {
            //         //停止并缩小svg
            //         q = !1, m.stop().animate({transform: "scale(1, 1, " + n.cx + ", " + n.cy + ")"}, 300)
            //     }
            // })
            (function () {
                q = !0, a(), j.attr({"stroke-dasharray": "0 55"}),
                    k.attr({offset: .29}), l.attr({offset: .2901}),
                    Snap.animate(0, i, function (a) {
                        if (a > 48)var a = 48;
                        var b = h.getPointAtLength(a);
                        g.transform("t" + parseInt(b.x - 63) + "," + parseInt(b.y - 42) + "r" + (b.alpha - 15));
                        var c = a - 1;
                        j.attr({"stroke-dasharray": (0 > c ? 0 : c) + " 55"}), a >= 48 ? (k.attr({offset: 1}), l.attr({offset: 1})) : (k.attr({offset: a / 48 * .55 + .29}), l.attr({offset: a / 48 * .55 + .2901}))
                    }, 1250), m.stop().animate({transform: "scale(1.45, 1.45, " + n.cx + ", " + n.cy + ")"}, 600, mina.bounce)
            })();
            setInterval(function () {
                q = !0, a(), j.attr({"stroke-dasharray": "0 55"}),
                    k.attr({offset: .29}), l.attr({offset: .2901}),
                    Snap.animate(0, i, function (a) {
                        if (a > 48)var a = 48;
                        var b = h.getPointAtLength(a);
                        g.transform("t" + parseInt(b.x - 63) + "," + parseInt(b.y - 42) + "r" + (b.alpha - 15));
                        var c = a - 1;
                        j.attr({"stroke-dasharray": (0 > c ? 0 : c) + " 55"}), a >= 48 ? (k.attr({offset: 1}), l.attr({offset: 1})) : (k.attr({offset: a / 48 * .55 + .29}), l.attr({offset: a / 48 * .55 + .2901}))
                    }, 1250), m.stop().animate({transform: "scale(1.45, 1.45, " + n.cx + ", " + n.cy + ")"}, 600, mina.bounce)
            },2000);
    }())
};

			});
	

		}
		
	}
});